package com.mvc.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @ClassName OrderTransaction
 * @Description TODO
 * @Author Gla
 * @Date 2021/12/2 11:31
 * @Version 1.0
 **/
@Data
public class OrderTransaction {
    private Integer id;
    private Integer user_id;
    private Integer order_no;
    private Integer pay_platform;
    private String platform_status;
    private BigDecimal pay_amout;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date create_time;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date update_time;

    private String statusName;
    public String getStatusName() {
        if ("1".equals(platform_status)) {
            return "已支付";
        }

        return "未支付";
    }

    private String platform;
    public String getPlatform() {
        if (pay_platform == 1) {
            return "支付宝";
        }else if (pay_platform == 2){
            return "微信";
        }
        return "未知平台";
    }
}
